Electronic devices have been provided with a variety of sensors. For example, a known mobile device includes a camera, a barometric pressure sensor that measures the barometric pressure, a touchscreen, and a controller. The controller infers that the mobile device is immersed in water on the basis of a detection result of the barometric pressure sensor and infers whether the mobile device that was immersed in water has been removed from the water on the basis of a detection result of the touchscreen. The controller of the known mobile device changes control of the function to capture, with the camera, at least one of a still image and a moving image on the basis of the detection result of at least one of the barometric pressure sensor and the touchscreen.